<template>
    <section class="content" style="min-height: 150px;">
        <Panel :expandable="false" :expand="true" :hasTitle="false" style="border: 0px;">
            <template slot="body">
                <el-form label-width="70px">
                    <el-row :gutter="12" style="padding-top: 10px;">
                        <el-col :span="20">
                            <el-form-item label="申请名称" label-width="150px">
                              <el-select v-model="receiverNumber" class="full-cell">
                                <el-option v-for="r in applyNameList" :label="r" :key="r" :value="r"></el-option>
                              </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="20">
                          <el-form-item label="" label-width="200px">
                            <el-button type="primary" @click="statusQuery" style="height: 40px; width: 140px; margin-top: 20px;" >查询</el-button>
                          </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </template>
        </Panel>
    </section>
</template>
<script>
import Panel from '@/components/common/panel'
import instance from '@/api/index.js'
import apiUrls from '@/js/common/apiUrls'
import {floatAdd, datetimeType, datetimeValueFormat} from '@/js/util'

export default {
    name: "apply",
    components: {
        Panel
    },
    data() {
        return {
          applyNameList: [],
          receiverNumber: ''
        };
    },
    created() {
      this.getApplyNameList();
    },
    methods: {
      statusQuery(){
        if(this.receiverNumber){
          let param = Object.assign({
            applyName: this.receiverNumber
          });
          let _this = this;
          instance({
            method: 'post',
            url: apiUrls.receive.statusQuery,
            params: param
          }).then(function (data) {
            if(data.data.success) {
              // this.$alert("查询成功，请查看结果！");
              _this.$emit('commited', '查询成功，请查看结果！');
            }
          }).catch(function (err) {
            console.log(err)
          });
        }else{
          this.$alert("请选择申请名称！");
          return;
        }
      },
      getApplyNameList() {
        let self = this;
        let param = {
        };
        instance({
          method: 'get',
          url: apiUrls.receive.applyNameList,
          data: param
        }).then(function (data) {
          self.applyNameList = data.data.data || [];
        }).catch(function (err) {
          console.log(err)
        });
      }
    }
}
</script>
<style scoped>
.el-date-editor {
    width: 100%;
}

.el-range-separator {
    width: 22px!important;
}
</style>
